dragData
Type
property
Summary
Specifies what data is being dragged during a drag and drop.
Syntax
set the dragData to <textToDrag>
set the dragData[<dataType>] to <dataToDrag>
Description
Use the dragData property to find out what is being dragged or to change the data being dragged during the drag.
If LiveCode is acting as the target of a drag-drop operation (i.e. during the context of a dragEnter, dragMove, dragDrop or dragLeave message), the dataData property can be queried for the data the source application is offering.
Setting a type of data during a mouseDown or dragStart handler will cause a drop-drop operation to commence when the handler finishes. Only one type of data can be set at once, although LiveCode will automatically convert between all the text formats.
You can query the keys of the dragData to find out what data types are available.
Which elements are present in the dragData array depends on what type of data is being dragged. It is possible for more than one element in the dragData array to be populated. Different drop destinations can each use the data type they need. (For example, a list field's dragDrop handler might use the dragData["text"] to ignore the styles, while an ordinary field's dragDrop handler might use the dragData["HTML"] to retain the styles.
LiveCode will automatically synthesize the three text properties text, html and rtf if any text data is present. For example setting the dragData["text"] will result in the dragData["html"] being set appropriately.
If you don't specify a dataType, the dragData property reports or sets the dragData["text"].
It is necessary to use double quotes around the keys of the dragData array because some of the key names (such as "files") are LiveCode reserved words. Quoting array indexes (other than integers) is a good practice anyway, but in the case of this property, it's necessary to avoid script errors.
From 7.0, the string in dragData ["text"] can also contain the Unicode characters
Examples
set the dragData["html"] to the htmlText of field 1
get URL the dragData["text"]
Related
function: arrayDecode, arrayEncode, textDecode, textEncode
glossary: property, handler, array, list field, element, message
keyword: element
message: dragDrop, dragEnter, dragMove, mouseDown, dragLeave, dragStart
property: clipboardData, RTFText, unicodeText, HTMLText
Compatibility and Support
Introduced
LiveCode 2.0
OS
mac
windows
linux
Platforms
desktop
server